package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.system.dto.DesignBasicInformationAddDto;
import com.ruoyi.system.mapper.DesignBasicInformationGenMapper;
import com.ruoyi.system.service.DesignBasicInformationService;
import com.ruoyi.system.domain.DesignBasicInformationGen;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class DesignBasicInformationImpl implements DesignBasicInformationService {
    @Resource
    private DesignBasicInformationGenMapper designBasicInformationGenMapper;
    @Override
    public boolean addDesignBasicInformation(DesignBasicInformationAddDto dto) {
        DesignBasicInformationGen designBasicInformationGen = new DesignBasicInformationGen();
        //复制数据
        BeanUtils.copyProperties(dto,designBasicInformationGen);
        //生成表单主键id
        String id = UUID.randomUUID().toString();
        designBasicInformationGen.setId(id);
        try {
            designBasicInformationGenMapper.insertSelective(designBasicInformationGen);

        }catch (Exception e){
            log.info("获取当前新增表单基础信息##异常##", e);
            return false;
        }
        return true;
    }
}
